<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>尾递归</title>
</head>
<body>
    <script>
        function Fibonacci(n, ac1, ac2) {
            if (n == 1) {
                return ac2;
            }
            else{
                return Fibonacci(n - 1, ac2, ac1 + ac2);
            }
        }

        function Fib(n) {
            return Fibonacci(n, 1, 1);
        }
    </script>
</body>
</html>